feat: add apps/demo sub-project for independent Vercel deployment#427
feat: add apps/demo sub-project for independent Vercel deployment#427
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Create a standalone demo application following the hotcrm Vercel pattern: - vercel.json with serverless function config and rewrites - api/[[...route]].ts catch-all serverless entry point - scripts/build-vercel.sh for ordered workspace builds - scripts/patch-symlinks.cjs for pnpm symlink dereference - objectstack.config.ts for local development - README.md with deployment documentation - Root demo:dev script and tsconfig reference - CHANGELOG.md and ROADMAP.md updates Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/objectql/sessions/5c9aaf48-333c-497e-89bb-44581595a4be
There was a problem hiding this comment.
Pull request overview
Adds a new apps/demo sub-project intended to be deployed as an independent Vercel serverless app (alongside apps/site) and documents/build-scripts it to follow the “hotcrm” deployment pattern.
Changes:
- Introduces
apps/demowith Vercel config, serverless catch-all handler, and local dev docs/config. - Adds demo build utilities (ordered workspace build + pnpm symlink dereference) for Vercel bundling.
- Wires the demo into the monorepo (tsconfig reference, root
demo:devscript, ignores, roadmap/changelog updates, lockfile).
Reviewed changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Adds apps/demo as a TS project reference. |
| ROADMAP.md | Marks demo Vercel deployment task as done. |
| pnpm-lock.yaml | Adds the new workspace importer and dependency resolutions. |
| package.json | Adds demo:dev script to run the demo app. |
| CHANGELOG.md | Adds an Unreleased entry describing the demo app addition. |
| apps/demo/vercel.json | Vercel serverless configuration (framework null, rewrites, includeFiles, limits). |
| apps/demo/tsconfig.json | Typecheck-only TS config for the demo project. |
| apps/demo/scripts/patch-symlinks.cjs | Dereferences pnpm symlinks for Vercel bundling compatibility. |
| apps/demo/scripts/build-vercel.sh | Builds required workspace packages in dependency order, then patches symlinks. |
| apps/demo/README.md | Documents local dev + Vercel multi-project setup and architecture. |
| apps/demo/package.json | Declares the demo workspace package and scripts/deps. |
| apps/demo/objectstack.config.ts | Local dev ObjectStack config using MemoryDriver + project-tracker showcase. |
| apps/demo/api/[[...route]].ts | Vercel serverless entry: bootstraps kernel, serves SPAs, body extraction, timeouts. |
| .gitignore | Ignores apps/demo/.vercel. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| "api/**/*.ts": { | ||
| "memory": 1024, | ||
| "maxDuration": 60, | ||
| "includeFiles": "{packages/*/dist,node_modules/@object-ui/console/dist,node_modules/@objectstack/plugin-auth/dist,node_modules/@objectstack/studio/dist}/**" |
There was a problem hiding this comment.
includeFiles paths are relative to the Vercel project root (apps/demo per README). The glob packages/*/dist won’t match anything under apps/demo/, so the serverless bundle may miss the built workspace outputs. Adjust the paths (e.g. to point to the monorepo root) or copy required dist/ artifacts into the demo project before bundling.
| "includeFiles": "{packages/*/dist,node_modules/@object-ui/console/dist,node_modules/@objectstack/plugin-auth/dist,node_modules/@objectstack/studio/dist}/**" | |
| "includeFiles": [ | |
| "../packages/*/dist/**", | |
| "node_modules/@object-ui/console/dist/**", | |
| "node_modules/@objectstack/plugin-auth/dist/**", | |
| "node_modules/@objectstack/studio/dist/**" | |
| ] |
| "@types/node": "^20.19.37", | ||
| "hono": "^4.12.8", | ||
| "typescript": "^5.9.3" | ||
| }, |
There was a problem hiding this comment.
This project imports @objectstack/runtime and @objectstack/driver-memory in api/[[...route]].ts, but they are not declared here. Relying on transitive dependencies is brittle (and can break Vercel bundling / pnpm strictness). Add them as direct dependencies (and consider moving runtime-required packages from devDependencies to dependencies).
| }, | |
| }, | |
| "dependencies": { | |
| "@objectstack/runtime": "^3.2.8", | |
| "@objectstack/driver-memory": "^3.2.8" | |
| }, |
| const reqPath = c.req.path.substring(basePath.length) || '/'; | ||
| const filePath = resolve(absoluteDist, reqPath.replace(/^\//, '')); | ||
| // Prevent path traversal: resolved path must stay within distPath | ||
| if (!filePath.startsWith(absoluteDist)) { | ||
| return c.text('Forbidden', 403); | ||
| } |
There was a problem hiding this comment.
The path traversal guard is bypassable: an absolute path like ${absoluteDist}-evil/... still passes startsWith(absoluteDist) even though it’s outside the dist directory. Use a safer check based on path.relative() (reject if it starts with .. or is absolute) or startsWith(absoluteDist + path.sep) after normalizing.
| ...(process.env.VERCEL_BRANCH_URL ? [`https://${process.env.VERCEL_BRANCH_URL}`] : []), | ||
| ...(process.env.VERCEL_PROJECT_PRODUCTION_URL ? [`https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`] : []), | ||
| ...(process.env.AUTH_TRUSTED_ORIGINS ? process.env.AUTH_TRUSTED_ORIGINS.split(',').map(s => s.trim()) : []), | ||
| ], |
There was a problem hiding this comment.
AUTH_TRUSTED_ORIGINS parsing can introduce empty strings (e.g. trailing commas), which may be treated as a wildcard/invalid origin depending on AuthPlugin behavior. After split(',').map(trim), filter out falsy entries before adding to trustedOrigins.
|
|
||
| ### Added | ||
|
|
||
| - **`apps/demo`** — standalone Vercel-deployable demo application ([#issue](https://github.com/objectstack-ai/objectql/issues)): |
There was a problem hiding this comment.
The changelog entry links to https://github.com/objectstack-ai/objectql/issues without an issue number. Update it to reference the actual issue/PR (e.g. #426) so the entry is actionable.
| - **`apps/demo`** — standalone Vercel-deployable demo application ([#issue](https://github.com/objectstack-ai/objectql/issues)): | |
| - **`apps/demo`** — standalone Vercel-deployable demo application ([#426](https://github.com/objectstack-ai/objectql/issues/426)): |
Standalone Vercel-deployable demo app following the hotcrm deployment pattern. Runs alongside
apps/siteas an independent Vercel project — zero impact on the existing docs site.apps/demo/— new filesvercel.json— frameworknull, 1 GiB / 60s serverless function, all routes rewritten to catch-all handlerapi/[[...route]].ts— bootstraps ObjectStack kernel (ObjectQL + InMemoryDriver + Auth + Console/Studio SPAs) via@hono/node-servergetRequestListener(). Handles Vercel's pre-bufferedrawBody,x-forwarded-protofixup, and timeout protection (50s budget)scripts/build-vercel.sh— ordered workspace build: types → core → platform-node → drivers → plugins → protocols → project-tracker examplescripts/patch-symlinks.cjs— derefs all pnpm symlinks innode_modules/for Vercel bundlingobjectstack.config.ts— local dev config reusing project-tracker showcase metadataREADME.md— local dev + Vercel deployment docs, architecture diagramRoot changes
package.json— addeddemo:devscripttsconfig.json— addedapps/demoproject reference.gitignore— addedapps/demo/.vercelROADMAP.md/CHANGELOG.md— updatedVercel multi-project setup
apps/siteapps/siteapps/demoapps/demonull(serverless)Each project is configured via its own
vercel.jsonwith independent build/deploy. Set Root Directory toapps/demoin Vercel project settings.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
fastdl.mongodb.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /home/REDACTED/work/objectql/objectql/node_modules/.bin/../vitest/vitest.mjs run packages/drivers/ packages/protocols/ --reporter=dot(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.